package org.ielts.domain.log;

import java.util.Date;

import javax.persistence.DiscriminatorColumn;
import javax.persistence.DiscriminatorType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne;

import org.ielts.domain.Atom;
import org.ielts.domain.base.Student;
import org.ielts.domain.security.User;

@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name = "logType", discriminatorType = DiscriminatorType.STRING)
public class SchoolLog extends Atom {

	@ManyToOne(fetch = FetchType.EAGER, optional = true)
	private Student student;
	private Date createTime;

	public SchoolLog() {
		this.createTime = new Date();
		this.logTime = this.createTime;
	}

	private Date logTime;

	private String logType;

	@ManyToOne(fetch = FetchType.EAGER)
	private User creator;

	@Override
	public String getTitle() {
		return super.title;
	}

	public Date getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}

	public Student getStudent() {
		return student;
	}

	public void setStudent(Student student) {
		this.student = student;
	}

	public User getCreator() {
		return creator;
	}

	public void setCreator(User creator) {
		this.creator = creator;
	}

	public String getLogType() {
		return logType;
	}

	public void setLogType(String logType) {
		this.logType = logType;
	}

	public Date getLogTime() {
		return logTime;
	}

	public void setLogTime(Date logTime) {
		this.logTime = logTime;
	}

}
